package org.jet.emall.rbac.transfer;

import org.jet.emall.rbac.dto.AdminPrivilegeDTO;
import org.jet.emall.rbac.po.AdminPrivilegeView;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author xiaozai
 * @version 1.0
 * @date 2020-04-10 13:42
 */

@Mapper
public interface AdminPrivilegeDtoTransfer {

    AdminPrivilegeDtoTransfer INSTANCE = Mappers.getMapper(AdminPrivilegeDtoTransfer.class);


    /**
     * 将权限视图PO转DTO
     * @param adminPrivilegeView
     * @return
     */
    @Mapping(target = "children",ignore = true)
    AdminPrivilegeDTO toDto(AdminPrivilegeView adminPrivilegeView);

    /**
     * 将权限视图PO列表转DTO列表
     * @param adminPrivilegeViewList
     * @return
     */
    List<AdminPrivilegeDTO> toDtoList(List<AdminPrivilegeView> adminPrivilegeViewList);
}
